package databse.persistent;

import java.util.List;







import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import orm.Actor;
import repositories.ActorRepository;

public class ActorPersistent extends Actor {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	@Autowired
	private ActorRepository actorRepository;
	
	public ActorPersistent(){
		ApplicationContext appContext = new ClassPathXmlApplicationContext("/beans.xml");
		actorRepository = (ActorRepository)appContext.getBean("actorRepository");
	}
	public List<Actor> findAll(){
		return actorRepository.findAll();
	}
	
	public List<Actor> findByFirstName(String firstName){
		return actorRepository.findByFirstName(firstName);
	}
	
	public Actor findOne(short id){
		return actorRepository.findOne(id);
	}
}
